<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<button v-on:click="add">添加</button>
			<h3 v-for="(item,index) in stus" :key="item.id">{{item.name,}}{{item.age}}</h3>
		</div>
		<script type="text/javascript">
			const app = new Vue({
				el: '#app',
				data: {
					stus: [{
							id: 1,
							name: '张三',
							age: 20
						},
						{
							id: 2,
							name: '李四',
							age: 30
						},
						{
							id: 3,
							name: '王五',
							age: 50
						}
					]
				},
				methods: {
					add: function() {
						const stu = {
							id: 4,
							name: '赵六',
							age: 60
						}
						// this.stus[3] = stu;
						this.stus.push(stu);

					}
				}
			})
		</script>
	</body>
</html>
